From 5c6ba9a62d015ce727d030873c12bb8aaa2dcb41 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 28 Jan 2021 08:37:13 -0700 Subject: [PATCH] tidy readability-convert-member-functions-to-static this took a little bit of hand editing for whitespace and one change that had to be reverted wrt a Functor signature. --- dg-100.cc | 2 +- dg-100.h | 2 +- duplicate.h | 2 +- geojson.h | 2 +- gpx.cc | 4 ++-- gpx.h | 4 ++-- height.h | 2 +- kml.cc | 2 +- kml.h | 2 +- lowranceusr.cc | 4 ++-- lowranceusr.h | 4 ++-- osm.cc | 2 +- osm.h | 2 +- polygon.h | 2 +- position.h | 2 +- radius.h | 2 +- smplrout.h | 2 +- trackfilter.h | 8 ++++---- unicsv.cc | 4 ++-- unicsv.h | 4 ++-- 20 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dg-100.cc b/dg-100.cc index a9f47e7da..e452997c0 100644 --- a/dg-100.cc +++ b/dg-100.cc @@ -145,7 +145,7 @@ Dg100Format::dg100_log(const char* fmt, ...) /* TODO: check whether negative lat/lon (West/South) are handled correctly */ float -Dg100Format::bin2deg(int val) const +Dg100Format::bin2deg(int val) { /* Assume that val prints in decimal digits as [-]dddmmffff * ddd: degrees diff --git a/dg-100.h b/dg-100.h index c147a9c84..9e09db46e 100644 --- a/dg-100.h +++ b/dg-100.h @@ -121,7 +121,7 @@ protected: static QDateTime bintime2utc(int date, int time); static void dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf); static void dg100_log(const char* fmt, ...); - float bin2deg(int val) const; + static float bin2deg(int val); void process_gpsfile(uint8_t* data, route_head** track) const; static uint16_t dg100_checksum(const uint8_t* buf, int count); size_t dg100_send(uint8_t cmd, const void* payload, size_t param_len) const; diff --git a/duplicate.h b/duplicate.h index d7fba88d8..1cce51029 100644 --- a/duplicate.h +++ b/duplicate.h @@ -70,7 +70,7 @@ private: Waypoint* wpt; }; - btree_node* addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode); + static btree_node* addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode); void free_tree(btree_node* tree); struct wpt_ptr { diff --git a/geojson.h b/geojson.h index c8285351f..26c729dbb 100644 --- a/geojson.h +++ b/geojson.h @@ -71,7 +71,7 @@ private: void geojson_waypt_pr(const Waypoint* waypoint) const; static Waypoint* waypoint_from_coordinates(const QJsonArray& coordinates); - void routes_from_polygon_coordinates(const QJsonArray& polygon); + static void routes_from_polygon_coordinates(const QJsonArray& polygon); void geojson_track_hdr(const route_head* track); void geojson_track_disp(const Waypoint* trackpoint) const; void geojson_track_tlr(const route_head* unused); diff --git a/gpx.cc b/gpx.cc index 1300d49a8..221415a89 100644 --- a/gpx.cc +++ b/gpx.cc @@ -71,12 +71,12 @@ GpxFormat::gpx_add_to_global(QStringList& ge, const QString& s) // Temporarily mock the old GPX writer's hardcoded fixed length for float/double // types. This can be removed once we have time/interest in regenerating all our // zillion reference files. -inline QString GpxFormat::toString(double d) const +inline QString GpxFormat::toString(double d) { return QString::number(d, 'f', 9); } -inline QString GpxFormat::toString(float f) const +inline QString GpxFormat::toString(float f) { return QString::number(f, 'f', 6); } diff --git a/gpx.h b/gpx.h index 4247afe53..be887cba5 100644 --- a/gpx.h +++ b/gpx.h @@ -188,8 +188,8 @@ private: static void gpx_add_to_global(QStringList& ge, const QString& s); - inline QString toString(double d) const; - inline QString toString(float f) const; + static inline QString toString(double d); + static inline QString toString(float f); void gpx_reset_short_handle(); void gpx_write_gdata(const QStringList& ge, const QString& tag) const; tag_mapping get_tag(const QString& t) const; diff --git a/height.h b/height.h index 0339d800d..5a854ec98 100644 --- a/height.h +++ b/height.h @@ -61,7 +61,7 @@ private: }, }; - double bilinear(double x1, double y1, double x2, double y2, double x, double y, double z11, double z12, double z21, double z22); + static double bilinear(double x1, double y1, double x2, double y2, double x, double y, double z11, double z12, double z21, double z22); double wgs84_separation(double lat, double lon); void correct_height(const Waypoint* wpt); diff --git a/kml.cc b/kml.cc index 07435c090..12ad2e2ff 100644 --- a/kml.cc +++ b/kml.cc @@ -670,7 +670,7 @@ void KmlFormat::kml_output_header(const route_head* header, const computed_trkda } } -int KmlFormat::kml_altitude_known(const Waypoint* waypoint) const +int KmlFormat::kml_altitude_known(const Waypoint* waypoint) { if (waypoint->altitude == unknown_alt) { return 0; diff --git a/kml.h b/kml.h index 375d50d08..bfa993e4c 100644 --- a/kml.h +++ b/kml.h @@ -134,7 +134,7 @@ private: static void kml_td(gpsbabel::XmlStreamWriter& hwriter, const QString& data); void kml_output_trkdescription(const route_head* header, const computed_trkdata* td) const; void kml_output_header(const route_head* header, const computed_trkdata* td) const; - int kml_altitude_known(const Waypoint* waypoint) const; + static int kml_altitude_known(const Waypoint* waypoint); void kml_write_coordinates(const Waypoint* waypointp) const; void kml_output_lookat(const Waypoint* waypointp) const; void kml_output_positioning(bool tessellate) const; diff --git a/lowranceusr.cc b/lowranceusr.cc index 247f23a7f..50d07784b 100644 --- a/lowranceusr.cc +++ b/lowranceusr.cc @@ -150,7 +150,7 @@ LowranceusrFormat::register_waypt(const Waypoint* wpt) const /* end borrowed from raymarine.c */ const Waypoint* -LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int uid_seq_high) const +LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int uid_seq_high) { // Iterate with waypt_disp_all? for (const Waypoint* waypointp : qAsConst(*global_waypoint_list)) { @@ -171,7 +171,7 @@ LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int u } const Waypoint* -LowranceusrFormat::lowranceusr4_find_global_waypt(uint id1, uint id2, uint id3, uint id4) const +LowranceusrFormat::lowranceusr4_find_global_waypt(uint id1, uint id2, uint id3, uint id4) { // Iterate with waypt_disp_all? for (const Waypoint* waypointp : qAsConst(*global_waypoint_list)) { diff --git a/lowranceusr.h b/lowranceusr.h index a4bf4621e..34b26b916 100644 --- a/lowranceusr.h +++ b/lowranceusr.h @@ -397,8 +397,8 @@ private: static char same_points(const Waypoint*, const Waypoint*); void register_waypt(const Waypoint*) const; - const Waypoint* lowranceusr4_find_waypt(uint, int, int) const; - const Waypoint* lowranceusr4_find_global_waypt(uint, uint, uint, uint) const; + static const Waypoint* lowranceusr4_find_waypt(uint, int, int); + static const Waypoint* lowranceusr4_find_global_waypt(uint, uint, uint, uint); QString lowranceusr4_readstr(gbfile*, int) const; void lowranceusr4_writestr(const QString&, gbfile*, int) const; static gpsbabel::DateTime lowranceusr4_get_timestamp(unsigned int, unsigned int); diff --git a/osm.cc b/osm.cc index ee6e758ae..b76d09744 100644 --- a/osm.cc +++ b/osm.cc @@ -415,7 +415,7 @@ OsmFormat::osm_strip_html(const char* str) } QString -OsmFormat::osm_strip_html(const QString& str) const +OsmFormat::osm_strip_html(const QString& str) { char* r = osm_strip_html(CSTR(str)); QString rv(r); diff --git a/osm.h b/osm.h index 7147322cd..609a0f419 100644 --- a/osm.h +++ b/osm.h @@ -97,7 +97,7 @@ private: char osm_feature_ikey(const QString& key) const; QString osm_feature_symbol(int ikey, const char* value) const; static char* osm_strip_html(const char* str); - QString osm_strip_html(const QString& str) const; + static QString osm_strip_html(const QString& str); void osm_node_end(xg_string /* unused */, const QXmlStreamAttributes* /* unused */); void osm_node(xg_string /* unused */, const QXmlStreamAttributes* attrv); void osm_node_tag(xg_string /* unused */, const QXmlStreamAttributes* attrv); diff --git a/polygon.h b/polygon.h index 3137f1d67..78e529603 100644 --- a/polygon.h +++ b/polygon.h @@ -58,7 +58,7 @@ private: }, }; - void polytest(double lat1, double lon1, + static void polytest(double lat1, double lon1, double lat2, double lon2, double wlat, double wlon, unsigned short* state, int first, int last); diff --git a/position.h b/position.h index c7e661919..dc9479e90 100644 --- a/position.h +++ b/position.h @@ -74,7 +74,7 @@ private: explicit WptRecord(Waypoint* w) : wpt(w) {} }; - double gc_distance(double lat1, double lon1, double lat2, double lon2); + static double gc_distance(double lat1, double lon1, double lat2, double lon2); void position_runqueue(WaypointList* waypt_list, int qtype); void position_process_any_route(const route_head* rh, int type); void position_process_rte(const route_head* rh); diff --git a/radius.h b/radius.h index 304f8db41..5935c105a 100644 --- a/radius.h +++ b/radius.h @@ -88,7 +88,7 @@ private: }, }; - double gc_distance(double lat1, double lon1, double lat2, double lon2); + static double gc_distance(double lat1, double lon1, double lat2, double lon2); }; #endif // FILTERS_ENABLED diff --git a/smplrout.h b/smplrout.h index a1bcce5c2..d78a25c93 100644 --- a/smplrout.h +++ b/smplrout.h @@ -126,7 +126,7 @@ private: const Waypoint* wpt{nullptr}; }; - void free_xte(struct xte* xte_rec); + static void free_xte(struct xte* xte_rec); struct xte_intermed* tmpprev = nullptr; int xte_count = 0; diff --git a/trackfilter.h b/trackfilter.h index 82b3b8848..5ecc9de39 100644 --- a/trackfilter.h +++ b/trackfilter.h @@ -178,7 +178,7 @@ private: bool need_time{}; /* initialized within trackfilter_init */ int trackfilter_opt_count(); - qint64 trackfilter_parse_time_opt(const char* arg); + static qint64 trackfilter_parse_time_opt(const char* arg); static bool trackfilter_init_sort_cb(const route_head* ha, const route_head* hb); static bool trackfilter_merge_sort_cb(const Waypoint* wa, const Waypoint* wb); fix_type trackfilter_parse_fix(int* nsats); @@ -202,7 +202,7 @@ private: void trackfilter_synth(); - QDateTime trackfilter_range_check(const char* timestr); + static QDateTime trackfilter_range_check(const char* timestr); void trackfilter_range(); void trackfilter_seg2trk(); @@ -215,9 +215,9 @@ private: bool force{false}; }; - faketime_t trackfilter_faketime_check(const char* timestr); + static faketime_t trackfilter_faketime_check(const char* timestr); void trackfilter_faketime(); /* returns number of track points left after filtering */ - bool trackfilter_points_are_same(const Waypoint* wpta, const Waypoint* wptb); + static bool trackfilter_points_are_same(const Waypoint* wpta, const Waypoint* wptb); void trackfilter_segment_head(const route_head* rte); diff --git a/unicsv.cc b/unicsv.cc index 1dc2d1e6f..7fb501a1a 100644 --- a/unicsv.cc +++ b/unicsv.cc @@ -170,7 +170,7 @@ const UnicsvFormat::field_t UnicsvFormat::fields_def[] = { // Parse GC-Code / geo cache reference code into int64 (GC-ID) // (see also https://api.groundspeak.com/documentation#referencecodes) long long -UnicsvFormat::unicsv_parse_gc_code(const QString& str) const +UnicsvFormat::unicsv_parse_gc_code(const QString& str) { if (! str.startsWith("GC")) { return 0; @@ -283,7 +283,7 @@ UnicsvFormat::unicsv_parse_date(const char* str, int* consumed) } time_t -UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date) const +UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date) { int hour, min, sec; int consumed = 0; diff --git a/unicsv.h b/unicsv.h index 509a6ba57..322d1df5a 100644 --- a/unicsv.h +++ b/unicsv.h @@ -172,9 +172,9 @@ private: /* Member Functions */ - long long int unicsv_parse_gc_code(const QString& str) const; + static long long int unicsv_parse_gc_code(const QString& str); static time_t unicsv_parse_date(const char* str, int* consumed); - time_t unicsv_parse_time(const char* str, int* usec, time_t* date) const; + static time_t unicsv_parse_time(const char* str, int* usec, time_t* date); time_t unicsv_parse_time(const QString& str, int* msec, time_t* date) const; static status_type unicsv_parse_status(const QString& str); QDateTime unicsv_adjust_time(time_t time, const time_t* date) const; -- 2.30.2